<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function math(m) {
            var i = 1 ;
            var a = m ;
            while (true){
                m = Math.floor(m/(i*10));
                if(m<10&&m>0){
                    document.write("最高位是"+m);
                    break;
                }else if(m<1){
                    document.write("最高位是"+Math.floor(a));
                    break;
                }
            }
        }
    </script>
</head>
<body>
<input type="button" value="按我" onclick="math(prompt('请输入数字：'))">
</body>
</html>